import * as tf from '@tensorflow/tfjs';

export function LSTM(numClasses, sequenceLength, units = 64, learningRate = 0.001) {
  const model = tf.sequential();
  
  // Input layer
  model.add(tf.layers.lstm({
    units: units,
    inputShape: [sequenceLength, 1],
    returnSequences: false
  }));
  
  // Output layer
  model.add(tf.layers.dense({
    units: numClasses,
    activation: 'softmax'
  }));
  
  // Compile the model
  model.compile({
    optimizer: tf.train.adam(learningRate),
    loss: 'categoricalCrossentropy',
    metrics: ['accuracy']
  });
  
  return model;
}